package com.qianxx.component.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.component.activity.chart.grid_chart.GridChartActivity;
import com.qianxx.component.activity.chart.line.LineActivity;
import com.qianxx.component.activity.chart.line_chart.LineChartActivity;
import com.qianxx.component.activity.chart.slip_area_chart.SlipAreaChartActivity;
import com.qianxx.component.activity.chart.slip_band_area_chart.SlipBandAreaChartActivity;
import com.qianxx.component.activity.chart.slip_line_chart.SlipLineChartActivity;
import com.qianxx.component.activity.chart.slip_stick_chart.SlipStickChartActivity;
import com.qianxx.component.activity.chart.statistical_bar.StatisticalBarActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;

public class ChartActivity extends BaseActivity {
    @BindView(R.id.lv)
    ListView lv;
    ArrayAdapter adapter;
    String[] listItems = {"Line", "GridChart", "LineChart", "SlipLineChart", "SlipAreaChart",
            "SlipBandAreaChart", "SlipStickChart", "StatisticalBar"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chart);
        ButterKnife.bind(this);

        adapter = new ArrayAdapter(this, R.layout.item, listItems);
        lv.setAdapter(adapter);
    }

    @OnItemClick(R.id.lv)
    void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        Class cls = null;
        switch (arg2) {
            case 0:
                cls = LineActivity.class;
                break;
            case 1:
                cls = GridChartActivity.class;
                break;
            case 2:
                cls = LineChartActivity.class;
                break;
            case 3:
                cls = SlipLineChartActivity.class;
                break;
            case 4:
                cls = SlipAreaChartActivity.class;
                break;
            case 5:
                cls = SlipBandAreaChartActivity.class;
                break;
            case 6:
                cls = SlipStickChartActivity.class;
                break;
            case 7:
                cls = StatisticalBarActivity.class;
                break;
        }
        Intent intent = new Intent(this, cls);
        startActivity(intent);
    }

    @Override
    public String setTitle() {
        return "图表类";
    }
}
